package cn.shyouchi.wuguanjia.android.api.youchi;


import cn.shyouchi.wuguanjia.android.http.HttpResult;
import cn.shyouchi.wuguanjia.android.model.LoginMod;
import cn.shyouchi.wuguanjia.android.model.RegisterMod;
import cn.shyouchi.wuguanjia.android.model.SmsCodeMod;
import cn.shyouchi.wuguanjia.android.model.SmsVerifyMod;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import rx.Observable;


public interface YouChiService {


    /**
     * 获取验证码
     *
     * @param telephone
     * @return
     */
    @FormUrlEncoded
    @POST("fetch_sms_code")
    Observable<SmsCodeMod> fetchSmsCode(@Field("telephone") String telephone);

    /**
     * 普通用户注册
     *
     * @param username
     * @param password
     * @param name
     * @param gender
     * @param birthday
     * @param address
     * @param number
     * @param publisher
     * @param validate
     * @param height
     * @param graduate
     * @param telephone
     * @param livingAddress
     * @param emergencyContact
     * @param industry
     * @param skill
     * @param channel
     * @param idCardPositive
     * @param idCardNegative
     * @param idCardHeadImage
     * @return
     */
    @Multipart
    @POST("register/user")
    Observable<RegisterMod> register(
            @Part("username") RequestBody username,
            @Part("password") RequestBody password,
            @Part("name") RequestBody name,
            @Part("gender") RequestBody gender,
            @Part("birthday") RequestBody birthday,
            @Part("address") RequestBody address,
            @Part("number") RequestBody number,
            @Part("publisher") RequestBody publisher,
            @Part("validate") RequestBody validate,
            @Part("height") RequestBody height,
            @Part("graduate") RequestBody graduate,
            @Part("telephone") RequestBody telephone,
            @Part("living_address") RequestBody livingAddress,
            @Part("emergency_contact") RequestBody emergencyContact,
            @Part("industry") RequestBody industry,
            @Part("skill") RequestBody skill,
            @Part("channel") RequestBody channel,
            @Part MultipartBody.Part idCardPositive,
            @Part MultipartBody.Part idCardNegative,
            @Part MultipartBody.Part idCardHeadImage);

    /**
     * 物管注册
     *
     * @param username
     * @param password
     * @param name
     * @param company
     * @param position
     * @param email
     * @return
     */
    @POST("register/property")
    Observable<HttpResult<String>> propertyRegister(@Query("username") String username,
                                                    @Query("password") String password,
                                                    @Query("name") String name,
                                                    @Query("company") String company,
                                                    @Query("position") String position,
                                                    @Query("email") String email);


    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */


//    {
//    username:eenie,
//    password:123456
//    }

//      http://host:port/path?data=ew0KICAgdXNlcm5hbWU6ZWVuaWUsDQogICBwYXNzd29yZDoxMjM0NTYNCiAgICB9

//      username=eenie&password=123
    @FormUrlEncoded
    @POST("login")
    Observable<LoginMod> login(@Field("username") String username, @Field("password") String password);
    @FormUrlEncoded
    @POST("fetch_sms_code/verification")
    Observable<SmsVerifyMod> smsVerify(@Header("token") String token, @Field("verify") String code);












}
